/* eslint-env browser */
const {
    BatchRecorder,
    jsonEncoder: {JSON_V2}
  } = require('zipkin');
  const {HttpLogger} = require('zipkin-transport-http');
  
  // Send spans to Zipkin asynchronously over HTTP
  const zipkinBaseUrl = 'http://localhost:9411';
  const recorder = new BatchRecorder({
    logger: new HttpLogger({
      endpoint: `${zipkinBaseUrl}/api/v2/spans`,
      jsonEncoder: JSON_V2
    })
  });
  
  module.exports.recorder = recorder;